<!-- common start -->
#include("common.html")
<!-- common end -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>留言</title>
<link rel="stylesheet" type="text/css" href="#(tpath)/static/css/css.css">
<script src="#(tpath)/static/js/jquery.min.js"></script>
<script src="#(tpath)/static/js/jquery.SuperSlide.2.1.1.js"></script>
</head>
<body>
<!-- header start -->
#include("header.html")
<!-- header end -->
    <div class="blank10 clear"></div>
    <div class="mainbody ">
    <div class=" bg">

    <div class="newstitle">
    您当前位置：<a  href="#(currentSite.url)/">首页</a> >> 留言
    </div>
        <div class="item-list">
           <form id="inputForm" action="#(currentSite.url)/api/guestbook" method="post">
			<table width="100%" class="table_form ">
			<tr>
				<th width="100"></th>
				<td></td>
			</tr>
			<tr>
				<th><font color="red">*</font>联系人：</th>
				<td><input type="text" value="" class="input-text" name="contact" id="contact"  style='width:150px;'></td>
			</tr>
			<tr>
				<th> <font color="red">*</font> 手机：</th>
				<td><input type="text" value="" class="input-text" name="mobile" id="mobile" style='width:150px;'></td>
			</tr>
			<tr>
				<th> <font color="red">*</font> 留言内容：</th>
				<td><textarea style="width:400px;height:90px;" name="content" id="content"></textarea></td>
			</tr>	
			<tr>
				<th> <font color="red">*</font> 验证码：</th>
				<td><input type="text" value="" class="input-text" name="captcha" id="captcha" style='width:150px;'><img id="captchaImage" src="#(currentSite.url)/common/captcha/image" title="点击更换验证码" style="height: 28px;"/></td>
			</tr>			
			<tr>
				<th >&nbsp;</th>
				<td ><input type="submit" class="button" value="提 交" name="submit"></td>
			</tr>
			</table>
			</form>

        </div>
    </div>
    </div>
    <div class="clear blank10"></div>
<!-- footer start -->
#include("footer.html")
<!-- footer end -->
</body>
</html>
<script type="text/javascript">
$(document).ready(function () {
    var $captchaImage = $("#captchaImage");
    
    // 更换验证码
    $captchaImage.click(function() {
        $captchaImage.attr("src", "#(currentSite.url)/common/captcha/image?timestamp=" + new Date().getTime());
    });
    
     $("#inputForm").submit(function() {
         var contact = $("#contact").val();
         if(contact == ""){
             alert("请输入联系人");
             return false;
         }
         var mobile = $("#mobile").val();
         if(mobile == ""){
             alert("请输入手机");
             return false;
         }
         var content = $("#content").val();
         if(content == ""){
             alert("请输入 留言内容");
             return false;
         }
         $.ajax({  
                type: $("#inputForm").attr("method"),
                dataType: "json", 
                url: $("#inputForm").attr("action"),
                data: $("#inputForm").serialize(),  
                error: function (data) { },  
                success: function (data){ 
                    if(data.type=="error"){
                        alert(data.msg);
                    }else{
                        alert("留言成功!");
                        location.reload();
                    }
                }  
            });  
         return false;
     });
    
    
    
});
</script>